import {
	defineConfig
} from 'vite'
import dns from 'dns'
import uni from '@dcloudio/vite-plugin-uni'

// dns.setDefaultResultOrder('verbatim')

export default defineConfig({
	plugins: [uni()],
	server: {
		proxy: {
			// 代理 websockets 或 socket.io 写法：ws://localhost:5173/dungeons/ws -> ws://192.168.50.10:10000/dungeons/ws
			'/dungeons/ws': {
				target: 'ws://192.168.50.10:10000',
                headers: { Authorization: "Bearer XXXXXX" },
				ws: true,
			},
			'/devices/ws': {
				target: 'ws://192.168.50.10:10000',
                headers: { Authorization: "Bearer XXXXXX" },
				ws: true,
			},
		},
	},
})